Maple 2018 Questions and Posts

These are Posts and Questions associated with the product, Maple 2018

Hi,
I want to have a colorbar aside the curve, but I can't. (My Maple version is 2018).

restart:
with(plots):

# --- constants ---
qc := 0.4:
qh := 0.64:
alpha := 0.8:

# --- parameter ranges ---
deltac_min := 0.01: deltac_max := 0.99:
Tch_min := 0.1:     Tch_max := 1.1:

# --- numerical safety ---
epsDen := 1e-12:
Mcap := 3.0: # cap to avoid infinity

# --- denominator ---
Den := (deltac, Tch) ->
       -2*Tch*deltac*qh - 2*Tch*deltac + 2*Tch*qh
       + 2*deltac*qc + 2*Tch + 2*deltac:

# --- safe functions ---
M1safe := (deltac, Tch) ->
    piecewise(Den(deltac,Tch) > epsDen,
              min(2/sqrt(Den(deltac,Tch)), Mcap),
              Mcap):

M0safe := (deltac, Tch) ->
    piecewise(Den(deltac,Tch) > epsDen,
              min(2*alpha/sqrt(Den(deltac,Tch)), Mcap),
              Mcap):

# --- density plots ---
p1 := densityplot(
       M1safe(deltac,Tch),
       deltac = deltac_min .. deltac_max,
       Tch   = Tch_min .. Tch_max,
       grid  = [200,200],
       style = patchnogrid,
       colorstyle = HUE,
       axes = boxed,
       labels = ["δ_c", "T_ch"],
       title = sprintf("M1(δ_c, T_ch)  (capped at %.2f)", Mcap)
     ):

p2 := densityplot(
       M0safe(deltac,Tch),
       deltac = deltac_min .. deltac_max,
       Tch   = Tch_min .. Tch_max,
       grid  = [200,200],
       style = patchnogrid,
       colorstyle = HUE,
       axes = boxed,
       labels = ["δ_c", "T_ch"],
       title = sprintf("M0(δ_c, T_ch)  (capped at %.2f)", Mcap)
     ):

# --- Contour Den = 0 (to mark physical boundary) ---
cont := contourplot(
          Den(deltac,Tch),
          deltac = deltac_min .. deltac_max,
          Tch   = Tch_min .. Tch_max,
          contours = [0],
          color = black,
          thickness = 2
        ):

# --- Overlay contour ---
p1_final := display(p1, cont):
p2_final := display(p2, cont):

# --- Display side by side ---
display(array([p1_final, p2_final]), scaling = constrained);

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

restart;
with(plots):

# === Constants ===
qc := 0.4:
qh := 0.64:
alpha := 0.8:

# === Denominator ===
Den := (deltac, Tch) ->
     -2*Tch*deltac*qh - 2*Tch*deltac + 2*Tch*qh
     + 2*deltac*qc + 2*Tch + 2*deltac:

# === M1 and M0 ===
M1 := (deltac, Tch) -> piecewise(Den(deltac,Tch)>0, 2/sqrt(Den(deltac,Tch)), undefined):
M0 := (deltac, Tch) -> piecewise(Den(deltac,Tch)>0, 2*alpha/sqrt(Den(deltac,Tch)), undefined):

# === Domain ===
deltac_min := 0.05:  deltac_max := 0.95:
Tch_min := 0.01:     Tch_max := 1.10:   # Physically realistic range

# === 3D Plots ===
p1 := plot3d(M1(deltac,Tch),
             deltac=deltac_min..deltac_max,
             Tch=Tch_min..Tch_max,
             grid=[80,80],
             axes=boxed,
             orientation=[-130,45],
             scaling=constrained,
             style=surfacecontour,
             color=green,
             labels=["δ_c", "T_ch", "M1"],
             labelfont=[TIMES,12],
             title="M1(δ_c, T_ch) for qc=0.4, qh=0.64"):

p2 := plot3d(M0(deltac,Tch),
             deltac=deltac_min..deltac_max,
             Tch=Tch_min..Tch_max,
             grid=[80,80],
             axes=boxed,
             orientation=[-130,45],
             scaling=constrained,
             style=surfacecontour,
             color=blue,
             labels=["δ_c", "T_ch", "M0"],
             labelfont=[TIMES,12],
             title="M0(δ_c, T_ch) for α=0.8, qc=0.4, qh=0.64"):

# === Display vertically (M1 above M0) ===
display(Array(1..2, [p1, p2]), insequence=true, scaling=constrained);
display(Array([[p1], [p2]]));

Good day.

Using the iterative map routine, the location of the bifurcation points of the logistic function can be determined using the plot (see attached).

I was wondering .. is it possible to estimate and output the locations of these points and the range of the function? I would like to explore the bifurcation behavior for the modified function so, this would be a great help. 

In this case, the location of the points are: (1.00,0.00), (3.00, 0.66), (3.45, 0.44), (3.45, 0.85) and the range is [0,4]. 

Thanks for reading!

MaplePrimes_Oct_16.mw

Good day.

I am looking into the behaviour of a function, V, that depends on several parameter values; these values are fixed in the attached example. However, I have encountered an issue that is puzzling me and I was hoping that someone may be able to shine a light on this for me.

Basically,  I would like to understand how the solution, V, behaves as the value of exponent, beta, approaches infinity.

Straightforward analysis suggests that the value of V tends to -10 as beta grows infinitely large (s -> C, and beta ->infinity and so, V -> -10 ... so far, so good).

However, when the function is plotted, the solution seems to converge to a value, 6.5, as beta tends to a very large number (10^17).

Now .. here's the mystery .. there appears to be a critical value of around 7.854 x 10^17; here, the limit seems to switch from V=6.5 to -10. Does this phenomenon correspond to a discontinuity or is it related to the computational process? Are there any built-in routines in Maple to check for such potential conditions?

Thanks for reading!

MaplePrimes_Sep_19.mw

dear sir here i am giving python code exicuting 3d plots but i cant plot animations like

restart;
Nc := .3; M := 1.5; QG := 1.5; Thetaa := .2; n1 := 1; n2 := 0; lambda1 := .1; lambda2 := .1; lambda3 := .1;

p := 2; a := .5; alpha1 := (1/2)*Pi;

p1 := 0.1e-1; p2 := 0.1e-1;
rf := 997.1; kf := .613; cpf := 4179; betaf := 21*10^(-5);

betas1 := .85*10^(-5); rs1 := 3970; ks1 := 40; cps1 := 765;
betas2 := 1.67*10^(-5); rs2 := 8933; ks2 := 401; cps2 := 385;

z1 := 1/((1-p1)^2.5*(1-p2)^2.5);
knf := kf*(ks1+2*kf-2*p1*(kf-ks1))/(ks1+2*kf+p1*(kf-ks1)); khnf := knf*(ks2+2*knf-2*p2*(knf-ks2))/(ks2+2*knf+p2*(knf-ks2));
z2 := 1-p1-p2+p1*rs1/rf+p2*rs2/rf;
z3 := 1-p1-p2+p1*rs1*cps1/(rf*cpf)+p2*rs2*cps2/(rf*cpf);
z4 := khnf/kf;
z5 := 1-p1-p2+p1*rs1*betas1/(rf*betaf)+p2*rs2*betas2/(rf*betaf);
OdeSys := z4*(X*(diff(Theta(X, tau), X, X))+diff(Theta(X, tau), X))/z3-(diff(Theta(X, tau), tau))-Nc*(Theta(X, tau)-Thetaa)^2*z5/z1-M^2*(Theta(X, tau)-Thetaa)^(p+1)*(1+n1*z2/z3)/(z3*(1-Thetaa)^p)-Nr*(Theta(X, tau)^4-Thetaa^4)/z3+QG*X*(1+lambda1*(Theta(X, tau)-Thetaa)+lambda2*(Theta(X, tau)-Thetaa)^2+lambda3*(Theta(X, tau)-Thetaa)^3)/z3; Cond := {Theta(0, tau) = 1+a*sin(alpha1), Theta(X, 0) = 0, (D[1](Theta))(1, tau) = 0};
OdeSys1 := z4*(X*(diff(Theta(X, tau), X, X))+diff(Theta(X, tau), X))/z3-(diff(Theta(X, tau), tau))-Nc*(Theta(X, tau)-Thetaa)^2*z5/z1-M^2*(Theta(X, tau)-Thetaa)^(p+1)*(1+n2*z2/z3)/(z3*(1-Thetaa)^p)-Nr*(Theta(X, tau)^4-Thetaa^4)/z3+QG*X*(1+lambda1*(Theta(X, tau)-Thetaa)+lambda2*(Theta(X, tau)-Thetaa)^2+lambda3*(Theta(X, tau)-Thetaa)^3)/z3; Cond1 := {Theta(0, tau) = 1+a*sin(alpha1), Theta(X, 0) = 0, (D[1](Theta))(1, tau) = 0};
OdeSysa := z4*(X*(diff(Theta(X, tau), X, X))+diff(Theta(X, tau), X))/z3-(diff(Theta(X, tau), tau))-Nc*(Theta(X, tau)-Thetaa)^2*z5/z1-M^2*(Theta(X, tau)-Thetaa)^(p+1)*(1+n1*z2/z3)/(z3*(1-Thetaa)^p)-Nr*(Theta(X, tau)^4-Thetaa^4)/z3+QG*X*(1+lambda1*(Theta(X, tau)-Thetaa)+lambda2*(Theta(X, tau)-Thetaa)^2+lambda3*(Theta(X, tau)-Thetaa)^3)/z3; Conda := {Theta(0, tau) = 1+a*cos(alpha1), Theta(X, 0) = 0, (D[1](Theta))(1, tau) = 0};
OdeSysa1 := z4*(X*(diff(Theta(X, tau), X, X))+diff(Theta(X, tau), X))/z3-(diff(Theta(X, tau), tau))-Nc*(Theta(X, tau)-Thetaa)^2*z5/z1-M^2*(Theta(X, tau)-Thetaa)^(p+1)*(1+n2*z2/z3)/(z3*(1-Thetaa)^p)-Nr*(Theta(X, tau)^4-Thetaa^4)/z3+QG*X*(1+lambda1*(Theta(X, tau)-Thetaa)+lambda2*(Theta(X, tau)-Thetaa)^2+lambda3*(Theta(X, tau)-Thetaa)^3)/z3; Conda1 := {Theta(0, tau) = 1+a*cos(alpha1), Theta(X, 0) = 0, (D[1](Theta))(1, tau) = 0};

colour := [cyan, black];
colour1 := [red, blue];
NrVals := [2.5, 3.5];
for j to numelems(NrVals) do Ans := pdsolve((eval([OdeSys, Cond], Nr = NrVals[j]))[], numeric, spacestep = 1/200, timestep = 1/100); Plots[j] := Ans:-plot(Theta(X, tau), tau = .8, linestyle = "solid", labels = ["Y", Theta(Y, tau)], color = colour[j], 'axes' = 'boxed'); eta[j] := Ans:-plot((int(z3*z5*Nc*(Theta(X, tau)-Thetaa)^2/(z1*z4)+NrVals[j]*(Theta(X, tau)^4-Thetaa^4)/z4+M^2*(Theta(X, tau)-Thetaa)^(p+1)*(1+n1*z2/z3)/(z4*(1-Thetaa)^p), X = 0 .. 1))/(z3*z5*Nc*(1-Thetaa)^2/(z1*z4)+NrVals[j]*(-Thetaa^4+1)/z4+M^2*(1-Thetaa)*(1+n1*z2/z3)/z4), tau = 0 .. 2, X = .8, linestyle = "solid", 'axes' = 'boxed', labels = [" τ ", " η "], color = colour[j]); Ans1 := pdsolve((eval([OdeSys1, Cond1], Nr = NrVals[j]))[], numeric, spacestep = 1/200, timestep = 1/100); Plots1[j] := Ans1:-plot(Theta(X, tau), tau = .8, linestyle = "dash", labels = ["Y", Theta(Y, tau)], color = colour[j], 'axes' = 'boxed'); eta1[j] := Ans1:-plot((int(z3*z5*Nc*(Theta(X, tau)-Thetaa)^2/(z1*z4)+NrVals[j]*(Theta(X, tau)^4-Thetaa^4)/z4+M^2*(Theta(X, tau)-Thetaa)^(p+1)*(1+n2*z2/z3)/(z4*(1-Thetaa)^p), X = 0 .. 1))/(z3*z5*Nc*(1-Thetaa)^2/(z1*z4)+NrVals[j]*(-Thetaa^4+1)/z4+M^2*(1-Thetaa)*(1+n2*z2/z3)/z4), tau = 0 .. 2, X = .8, linestyle = "dash", 'axes' = 'boxed', labels = [" τ ", " η "], color = colour[j]); Ansa := pdsolve((eval([OdeSysa, Conda], Nr = NrVals[j]))[], numeric, spacestep = 1/200, timestep = 1/100); Plotsa[j] := Ansa:-plot(Theta(X, tau), tau = .8, linestyle = "solid", labels = ["Y", Theta(Y, tau)], color = colour1[j], 'axes' = 'boxed'); etaa[j] := Ansa:-plot((int(z3*z5*Nc*(Theta(X, tau)-Thetaa)^2/(z1*z4)+NrVals[j]*(Theta(X, tau)^4-Thetaa^4)/z4+M^2*(Theta(X, tau)-Thetaa)^(p+1)*(1+n1*z2/z3)/(z4*(1-Thetaa)^p), X = 0 .. 1))/(z3*z5*Nc*(1-Thetaa)^2/(z1*z4)+NrVals[j]*(-Thetaa^4+1)/z4+M^2*(1-Thetaa)*(1+n1*z2/z3)/z4), tau = 0 .. 2, X = .8, linestyle = "solid", 'axes' = 'boxed', labels = [" τ ", " η "], color = colour1[j]); Ansa1 := pdsolve((eval([OdeSysa1, Conda1], Nr = NrVals[j]))[], numeric, spacestep = 1/200, timestep = 1/100); Plotsa1[j] := Ansa1:-plot(Theta(X, tau), tau = .8, linestyle = "dash", labels = ["Y", Theta(Y, tau)], color = colour1[j], 'axes' = 'boxed'); etaa1[j] := Ansa1:-plot((int(z3*z5*Nc*(Theta(X, tau)-Thetaa)^2/(z1*z4)+NrVals[j]*(Theta(X, tau)^4-Thetaa^4)/z4+M^2*(Theta(X, tau)-Thetaa)^(p+1)*(1+n2*z2/z3)/(z4*(1-Thetaa)^p), X = 0 .. 1))/(z3*z5*Nc*(1-Thetaa)^2/(z1*z4)+NrVals[j]*(-Thetaa^4+1)/z4+M^2*(1-Thetaa)*(1+n2*z2/z3)/z4), tau = 0 .. 2, X = .8, linestyle = "dash", 'axes' = 'boxed', labels = [" τ ", " η "], color = colour1[j]) end do;
plotA := plots:-display([seq(Plots[j], j = 1 .. 2)]);
plotB := plots:-display([seq(Plots1[j], j = 1 .. 2)]);
plotAA := plots:-display([seq(Plotsa[j], j = 1 .. 2)]);
plotBB := plots:-display([seq(Plotsa1[j], j = 1 .. 2)]);
plotC := plots:-display([seq(eta[j], j = 1 .. 2)]);
plotD := plots:-display([seq(eta1[j], j = 1 .. 2)]);
plotCC := plots:-display([seq(etaa[j], j = 1 .. 2)]);

plotDD := plots:-display([seq(etaa1[j], j = 1 .. 2)]);
plots:-display([plotA, plotB, plotAA, plotBB], size = [700, 700]);

plots:-display([plotC, plotD, plotCC, plotDD], size = [700, 700]);

how to take animation of the plots

 

i have seen some plots in maple also for that reason i have posted this question here

paper2_new_efficiency_plots_2025.mw

Hi,
I want to solve equations (1) and (2) to obtain the values of certain quantities, for example x and f. In fact, both equations must be satisfied simultaneously for \tau and f. Since there are other parameters in these equations (for example \tau, M, etc.), and I do not know the optimal values of these parameters, I would like to solve equations (1) and (2) over given ranges for tau, M, and so on. I know that I should use loop commands, but I keep encountering errors. Please guide me.
fsolve.mw

Hi 
How can I plot f3=0 for different values of Tch and qc?

1.mw

How to get amultiple line plots in one graph for differnt values of E1 := .1,0.2,0.3,and 0.4 with differnt color line red,blue,black and green and how to get numerical values for the all E1 value in one matrix form 

at E1=0.1 value of diff(g(x), x, x), diff(f(x), x, x),diff(f(x), x) and diff(g(x),  x).

AGM_method_single_line_plot.mw

How to solve two boundary problems in one graph not getting graphs shown in pdf
symetry_paper_work.mw
symmetry_graphs_pdf.pdf

How to get table values 

why this error is getting. but in the published paper for the same parameter it is converging. what is the mistake in this worksheet please rectify it in sachin_base_paper.mw

Someone should please help me compute the left and right eigenvectors of the system below. The purpose is to compute values for 'a' and 'b' in the bifurcation formula.

Thank you

``

with(VectorCalculus)

 

(1)

interface(imaginaryunit = I)

I

(2)

I

I

(3)
 

diff(S(t), t) := `Λ__p`-(`#mrow(mi("ϕ",fontstyle = "normal"),mo("⋅"),msub(mi("θ",fontstyle = "normal"),mi("B")),mo("⋅"),msub(mi("I"),mi("B")))`/N[p]+µ__C)*S+`ω__B`*I__B

Lambda__p-(`#mrow(mi("ϕ",fontstyle = "normal"),mo("⋅"),msub(mi("θ",fontstyle = "normal"),mi("B")),mo("⋅"),msub(mi("I"),mi("B")))`/N[p]+µ__C)*S+omega__B*I__B

(4)

diff(I__B(t), t) := `#mrow(mi("ϕ",fontstyle = "normal"),mo("⋅"),msub(mi("θ",fontstyle = "normal"),mi("B")),mo("⋅"),msub(mi("I"),mi("B")))`*S/N[p]-`ω__B`*I__B-(`σ__B`+µ__C)*I__B

`#mrow(mi("ϕ",fontstyle = "normal"),mo("⋅"),msub(mi("θ",fontstyle = "normal"),mi("B")),mo("⋅"),msub(mi("I"),mi("B")))`*S/N[p]-omega__B*I__B-(sigma__B+µ__C)*I__B

(5)

NULL

``

(6)

diff(S__A(t), t) := `Λ__A`-(µ__A+`#mrow(mi("ϕ",fontstyle = "normal"),mo("⋅"),msub(mi("α",fontstyle = "normal"),mi("B")),mo("⋅"),msub(mi("I"),mi("B")))`/N[p])*S__A+`δ__A`*I__A

Lambda__A-(µ__A+`#mrow(mi("ϕ",fontstyle = "normal"),mo("⋅"),msub(mi("α",fontstyle = "normal"),mi("B")),mo("⋅"),msub(mi("I"),mi("B")))`/N[p])*S__A+delta__A*I__A

(7)

diff(I__A(t), t) := `#mrow(mi("ϕ",fontstyle = "normal"),mo("⋅"),msub(mi("α",fontstyle = "normal"),mi("B")),mo("⋅"),msub(mi("I"),mi("B")))`*S__A/N[p]-(µ__A+`δ__A`)*I__A

`#mrow(mi("ϕ",fontstyle = "normal"),mo("⋅"),msub(mi("α",fontstyle = "normal"),mi("B")),mo("⋅"),msub(mi("I"),mi("B")))`*S__A/N[p]-(µ__A+delta__A)*I__A

(8)

NULL

``

(9)

Download CBD2.mw

It is not difficult to manually check the validity of the identity  sqrt(x+2*sqrt(x-1)) = sqrt(x-1)+1 , which is true at least for all  x>=1 . I don't know of any Maple command that directly makes this simplification:

expr:=sqrt(x+2*sqrt(x-1));
simplify(expr);
simplify(expr) assuming x>=1;

                          


It was possible to simplify it only by making a variable substitution  x=y+1 (and then a reverse substitution  y=x-1 ) :

expr1:=subs(x=y+1,expr);
simplify(expr1);
subs(y=x-1, %);

                               


By the way,  the CAS Mathematica also cannot cope with simplifying the expression  expr .

Good day.

I am constructing a 4-set Venn Diagram and I would like to know if it is possible to fix the number of decimal places in the solution.

The attached worksheet is given as an example; the default number of decimal places seems to be 2. I would like this to be either 0 or 1 (for both absolute and relative values). 

Does anyone know how to do this? 

Thanks for reading!

MaplePrimes_Venn_Diagram.mw

How to solve these pde equations in maple to get the similar type graphs.

Ode equations we can solve directly but these equations are pde .

in the article they have solved the governing equations by series solution? 

can we solve these equations in maple also by series solution or any other method is there to solve these equations

Someone please help me with the computation of the right and left eigenvectors. my system of equation is attached below

with(VectorCalculus):

 

interface(imaginaryunit = I)

I

(2)

I

I

(3)

sqrt(-4)

2*I

(4)

NULL

``

Limit(N(t) = N__0*exp(-mu*t)+exp(mu*t)*K/mu, t = infinity)

 

limit(N(t), t = infinity) = limit(N__0*exp(-mu*t)+exp(mu*t)*K/mu, t = infinity)

(5)

 

NULL

#to calculate the  disease free equilibrium,

NULL

E1 := -S*µ__C+`Λ__p`

-S*µ__C+Lambda__p

(6)

NULL

``

(7)

E3 := -S__A*µ__A+`Λ__A`

-S__A*µ__A+Lambda__A

(8)

NULL

``

(9)

NULL

``

(10)

NULL

solve({E1 = 0, E3 = 0}, {S, S__A})

{S = Lambda__p/µ__C, S__A = Lambda__A/µ__A}

(11)

NULL

NULL#to calculate the Endemic Equilibrium state,

Typesetting:-mparsed()

(12)

restart

with(VectorCalculus):

 

interface(imaginaryunit = I)

I

(14)

I

I

(15)

sqrt(-4)

2*I

(16)

``

E1 := `Λ__p`-(`ϕ`*`θ__B`*I__A/N__p+µ__C)*S+`ω__B`*I__B

Lambda__p-(varphi*theta__B*I__A/N__p+µ__C)*S+omega__B*I__B

(17)

E2 := `ϕ`*`θ__B`*I__A*S/N__p-`ω__B`*I__B-(`σ__B`+µ__C)*I__B

varphi*theta__B*I__A*S/N__p-omega__B*I__B-(sigma__B+µ__C)*I__B

(18)

``

(19)

E3 := `Λ__A`-(µ__A+`ϕ`*`α__B`*I__B/N__p)*S__A+`δ__A`*I__A

Lambda__A-(µ__A+varphi*alpha__B*I__B/N__p)*S__A+delta__A*I__A

(20)

E4 := `ϕ`*`α__B`*I__B*S__A/N__p-(µ__A+`δ__A`)*I__A

varphi*alpha__B*I__B*S__A/N__p-(µ__A+delta__A)*I__A

(21)

NULL

``

(22)

NULL

``

(23)

solve({E1 = 0, E2 = 0, E3 = 0, E4 = 0}, {I__A, I__B, S, S__A})

{I__A = 0, I__B = 0, S = Lambda__p/µ__C, S__A = Lambda__A/µ__A}, {I__A = -(N__p^2*µ__A^2*µ__C^2+N__p^2*µ__A^2*µ__C*omega__B+N__p^2*µ__A^2*µ__C*sigma__B+N__p^2*µ__A*µ__C^2*delta__A+N__p^2*µ__A*µ__C*delta__A*omega__B+N__p^2*µ__A*µ__C*delta__A*sigma__B-varphi^2*Lambda__A*Lambda__p*alpha__B*theta__B)/(varphi*µ__A*theta__B*(N__p*µ__A*µ__C+N__p*µ__A*sigma__B+N__p*µ__C*delta__A+N__p*delta__A*sigma__B+varphi*Lambda__p*alpha__B)), I__B = -(N__p^2*µ__A^2*µ__C^2+N__p^2*µ__A^2*µ__C*omega__B+N__p^2*µ__A^2*µ__C*sigma__B+N__p^2*µ__A*µ__C^2*delta__A+N__p^2*µ__A*µ__C*delta__A*omega__B+N__p^2*µ__A*µ__C*delta__A*sigma__B-varphi^2*Lambda__A*Lambda__p*alpha__B*theta__B)/(alpha__B*(N__p*µ__A*µ__C^2+N__p*µ__A*µ__C*omega__B+N__p*µ__A*µ__C*sigma__B+varphi*µ__C*Lambda__A*theta__B+varphi*Lambda__A*sigma__B*theta__B)*varphi), S = (N__p*µ__A*µ__C+N__p*µ__A*sigma__B+N__p*µ__C*delta__A+N__p*delta__A*sigma__B+varphi*Lambda__p*alpha__B)*µ__A*N__p*(µ__C+omega__B+sigma__B)/(alpha__B*varphi*(N__p*µ__A*µ__C^2+N__p*µ__A*µ__C*omega__B+N__p*µ__A*µ__C*sigma__B+varphi*µ__C*Lambda__A*theta__B+varphi*Lambda__A*sigma__B*theta__B)), S__A = N__p*(N__p*µ__A^2*µ__C^2+N__p*µ__A^2*µ__C*omega__B+N__p*µ__A^2*µ__C*sigma__B+N__p*µ__A*µ__C^2*delta__A+N__p*µ__A*µ__C*delta__A*omega__B+N__p*µ__A*µ__C*delta__A*sigma__B+varphi*µ__A*µ__C*Lambda__A*theta__B+varphi*µ__A*Lambda__A*sigma__B*theta__B+varphi*µ__C*Lambda__A*delta__A*theta__B+varphi*Lambda__A*delta__A*sigma__B*theta__B)/(varphi*µ__A*theta__B*(N__p*µ__A*µ__C+N__p*µ__A*sigma__B+N__p*µ__C*delta__A+N__p*delta__A*sigma__B+varphi*Lambda__p*alpha__B))}

(24)

``

J := Jacobian([E1, E2, E3, E4], [S, I__B, S__A, I__A])

Matrix(%id = 18446746854857131062)

(25)

NULL

restart

J := Matrix(4, 4, {(1, 1) = -`ϕ`*`θ__B`*I__A/N__p-µ__C, (1, 2) = `ω__B`, (1, 3) = 0, (1, 4) = -`ϕ`*`θ__B`*S/N__p, (2, 1) = `ϕ`*`θ__B`*I__A/N__p, (2, 2) = -`ω__B`-`σ__B`-µ__C, (2, 3) = 0, (2, 4) = `ϕ`*`θ__B`*S/N__p, (3, 1) = 0, (3, 2) = -`ϕ`*`α__B`*S__A/N__p, (3, 3) = -µ__A-`ϕ`*`α__B`*I__B/N__p, (3, 4) = `δ__A`, (4, 1) = 0, (4, 2) = `ϕ`*`α__B`*S__A/N__p, (4, 3) = `ϕ`*`α__B`*I__B/N__p, (4, 4) = -µ__A-`δ__A`})

Matrix(%id = 18446746579340105118)

(26)

S := `Λ__p`/µ__C

Lambda__p/µ__C

(27)

S__A := `Λ__A`/µ__A

Lambda__A/µ__A

(28)

I__B := 0

0

(29)

I__A := 0

0

(30)

NULL

0

(31)

J := Matrix(4, 4, {(1, 1) = -`ϕ`*`θ__B`*I__A/N__p-µ__C, (1, 2) = `ω__B`, (1, 3) = 0, (1, 4) = -`ϕ`*`θ__B`*S/N__p, (2, 1) = `ϕ`*`θ__B`*I__A/N__p, (2, 2) = -`ω__B`-`σ__B`-µ__C, (2, 3) = 0, (2, 4) = `ϕ`*`θ__B`*S/N__p, (3, 1) = 0, (3, 2) = -`ϕ`*`α__B`*S__A/N__p, (3, 3) = -µ__A-`ϕ`*`α__B`*I__B/N__p, (3, 4) = `δ__A`, (4, 1) = 0, (4, 2) = `ϕ`*`α__B`*S__A/N__p, (4, 3) = `ϕ`*`α__B`*I__B/N__p, (4, 4) = -µ__A-`δ__A`})

Matrix(%id = 18446746579340107518)

(32)

J := Matrix(4, 4, {(1, 1) = -µ__C, (1, 2) = `ω__B`, (1, 3) = 0, (1, 4) = -`β__1`, (2, 1) = 0, (2, 2) = -`ω__B`-`σ__B`-µ__C, (2, 3) = 0, (2, 4) = -`β__1`, (3, 1) = 0, (3, 2) = -`β__2`, (3, 3) = -µ__A, (3, 4) = `δ__A`, (4, 1) = 0, (4, 2) = `β__2`, (4, 3) = 0, (4, 4) = -µ__A-`δ__A`})

Matrix(%id = 18446746579417403630)

(33)

"simplify( ? )"

Matrix(%id = 18446746579305905318)

(34)

"LinearAlgebra:-Eigenvalues( ? )"

Vector[column](%id = 18446746579445964182)

(35)

"LinearAlgebra:-CharacteristicPolynomial( ?, lambda )"

lambda^4+(2*µ__A+delta__A+omega__B+sigma__B+2*µ__C)*lambda^3+(beta__1*beta__2+µ__A^2+4*µ__A*µ__C+µ__A*delta__A+2*µ__A*omega__B+2*µ__A*sigma__B+µ__C^2+2*µ__C*delta__A+µ__C*omega__B+µ__C*sigma__B+delta__A*omega__B+delta__A*sigma__B)*lambda^2+(beta__1*beta__2*µ__A+beta__1*beta__2*µ__C+2*µ__A^2*µ__C+µ__A^2*omega__B+µ__A^2*sigma__B+2*µ__A*µ__C^2+2*µ__A*µ__C*delta__A+2*µ__A*µ__C*omega__B+2*µ__A*µ__C*sigma__B+µ__A*delta__A*omega__B+µ__A*delta__A*sigma__B+µ__C^2*delta__A+µ__C*delta__A*omega__B+µ__C*delta__A*sigma__B)*lambda+beta__1*beta__2*µ__A*µ__C+µ__A^2*µ__C^2+µ__A^2*µ__C*omega__B+µ__A^2*µ__C*sigma__B+µ__A*µ__C^2*delta__A+µ__A*µ__C*delta__A*omega__B+µ__A*µ__C*delta__A*sigma__B

(36)

NULL

"(->)"

Vector[column](%id = 18446746579340117046)

(37)

# to find the trace we

 

Matrix(7, 7, {(1, 1) = -beta*lambda-v__1-µ, (1, 2) = v__2, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (1, 7) = 0, (2, 1) = v__1, (2, 2) = beta*(w-1)*lambda-µ-v__2-alpha, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (3, 1) = 0, (3, 2) = alpha, (3, 3) = -µ, (3, 4) = 0, (3, 5) = `ρ__A`, (3, 6) = `ρ__F`, (3, 7) = -(-1+k)*`ρ__Q`, (4, 1) = beta*lambda, (4, 2) = -beta*(w-1)*lambda, (4, 3) = 0, (4, 4) = -q__E-delta-µ, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = a*delta, (5, 5) = -`ρ__A`-q__A-µ, (5, 6) = 0, (5, 7) = k*`ρ__Q`, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = -delta*(-1+a), (6, 5) = 0, (6, 6) = -`ρ__F`-q__F-`δ__F`-µ, (6, 7) = 0, (7, 1) = 0, (7, 2) = 0, (7, 3) = 0, (7, 4) = q__E, (7, 5) = q__A, (7, 6) = q__F, (7, 7) = -`ρ__Q`-`δ__Q`-µ})

Matrix(%id = 36893490965935089652)

(38)

"(->)"

-beta*lambda-v__1-7*µ+beta*(w-1)*lambda-v__2-alpha-q__E-delta-rho__A-q__A-rho__F-q__F-delta__F-rho__Q-delta__Q

(39)

 

#this shows that trace is negative

 

#to Achieve stability, the value below must be less than zero

 

(-q__E-delta-µ)*(-`&rho;__F`-q__F-`&delta;__F`-µ)*(-k*q__A*`&rho;__Q`+q__A*µ+q__A*`&delta;__Q`+q__A*`&rho;__Q`+µ^2+µ*`&delta;__Q`+µ*`&rho;__A`+µ*`&rho;__Q`+`&delta;__Q`*`&rho;__A`+`&rho;__A`*`&rho;__Q`)*µ < 0

(-q__E-delta-µ)*(-rho__F-q__F-delta__F-µ)*(-k*q__A*rho__Q+q__A*rho__Q+q__A*µ+q__A*delta__Q+rho__A*rho__Q+rho__A*µ+rho__A*delta__Q+rho__Q*µ+µ^2+µ*delta__Q)*µ < 0

(40)

 NULL

M := diff(N(t), t) = Pi-µ*N(t)

diff(N(t), t) = Pi-µ*N(t)

(41)

dsolve({M}, N(t))

{N(t) = Pi/µ+exp(-µ*t)*_C1}

(42)

eval({N(t) = Pi/µ+exp(-µ*t)*_C1}, [t = infinity])

{N(infinity) = Pi/µ+exp(-µ*infinity)*_C1}

(43)

value(%)

{N(infinity) = Pi/µ+exp(-µ*infinity)*_C1}

(44)

Limit(N(t) = Pi/µ+exp(-µ*t)*_C1, t = infinity); value(%)

Limit(N(t) = Pi/µ+exp(-µ*t)*_C1, t = infinity)

 

limit(N(t), t = infinity) = limit(Pi/µ+exp(-µ*t)*_C1, t = infinity)

(45)

 

Subs := diff(S(t), t) = -(beta*lambda+v__1+µ)*S(t)

diff(S(t), t) = -(beta*lambda+v__1+µ)*S(t)

(46)

dsolve({Subs}, S(t))

{S(t) = _C1*exp(-(beta*lambda+v__1+µ)*t)}

(47)
 

``

Download Cotton_DFE_and_Jacobian.mw

Please, I am encountering error trying to run these codes for sensitivity analysis using the formula for sensitivity analysis

``

restart;

#
# Set up numerical values for all problem parameters
#
  params:=[ Lambda__p=100,         gamma__B=0.05,      gamma__B=0.05,
                 gamma__C=0.01, omega__C=0.001,  omega__B=0.001,
            sigma__B=0.0001,     sigma__C=0.01, sigma__BC=0.01,
                theta__B=0.8,     theta__C=0.5,      mu__C=1.0,
              Lambda__A=1.0,       Lambda__w=1.0,   varphi__8.33,
            mu__A=1.0, mu__w=1.0, alpha__B=0.005, alpha__C=0.005, alpha__BC=0.15, Zeta__B=0.5, Zeta__C=0.5, delta__A=0.66, delta__w=1.33
          ]:

#
# Define main function
#
  R:= (varphi^2*theta__B*Lambda__p*alpha__B*Lambda__A)/((mu__c*mu__A*N__p^2)*(mu__A*mu__c+mu__A*omega__B+mu__A*sigma__B+mu__c*delta__A+delta__A*omega__B+delta__A*sigma__B));

varphi^2*theta__B*Lambda__p*alpha__B*Lambda__A/(mu__c*mu__A*N__p^2*(mu__A*mu__c+mu__A*omega__B+mu__A*sigma__B+mu__c*delta__A+delta__A*omega__B+delta__A*sigma__B))

(1)

#
# Compute "all" derivatives and evaluate numerically.
#
# For the purposes of this calculation "all"
# derivatives, means the derivatives with respect to
# every variable returned by indets(R, name)
#
# Output a list of two element lists where each of
# the latter is
#
# [ varName,
#   eval( diff( R, varName), params )
# ]
#
 [ seq( [j, eval( diff( R, j), params )],j in indets(R, name))];

Error, invalid input: eval expects its 2nd argument, eqns, to be of type {integer, equation, set(equation)}, but received [Lambda__p = 100, gamma__B = 0.5e-1, gamma__B = 0.5e-1, gamma__C = 0.1e-1, omega__C = 0.1e-2, omega__B = 0.1e-2, sigma__B = 0.1e-3, sigma__C = 0.1e-1, sigma__BC = 0.1e-1, theta__B = .8, theta__C = .5, mu__C = 1.0, Lambda__A = 1.0, Lambda__w = 1.0, 33*varphi__8, mu__A = 1.0, mu__w = 1.0, alpha__B = 0.5e-2, alpha__C = 0.5e-2, alpha__BC = .15, Zeta__B = .5, Zeta__C = .5, delta__A = .66, delta__w = 1.33]

 

#
# Compute all "sensitivities" (where the sensitivity
# is as defined in Rouben Rostamian response to the
# OP's earlier post) and evaluate numerically.
#
# For the purposes of this calculation "all" sensitivities
# means the sensitivity with respect to every variable
# returned by indets(R, name)
#
# Output a list of two element lists where each of
# the latter is
#
# [ varName,
#   eval( varName*diff( R, varName)/R, params )
# ]
#
  seq( [j, eval( j*diff( R, j)/R, params )],j in indets(R, name));

Error, invalid input: eval expects its 2nd argument, eqns, to be of type {integer, equation, set(equation)}, but received [Lambda__p = 100, gamma__B = 0.5e-1, gamma__B = 0.5e-1, gamma__C = 0.1e-1, omega__C = 0.1e-2, omega__B = 0.1e-2, sigma__B = 0.1e-3, sigma__C = 0.1e-1, sigma__BC = 0.1e-1, theta__B = .8, theta__C = .5, mu__C = 1.0, Lambda__A = 1.0, Lambda__w = 1.0, 33*varphi__8, mu__A = 1.0, mu__w = 1.0, alpha__B = 0.5e-2, alpha__C = 0.5e-2, alpha__BC = .15, Zeta__B = .5, Zeta__C = .5, delta__A = .66, delta__w = 1.33]

 

Download Computed_Sensitivity_Analys_for_CBD.mw

1 2 3 4 5 6 7 Last Page 1 of 63